home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 2: Applications / Linux Cubed Series 2 - Applications.iso / editors / emacs / emacs-19.000 / emacs-19 / usr / local / info / emacs-12 < prev    next >
Encoding:
GNU Info File  |  1995-09-11  |  47.9 KB  |  1,228 lines

  1. This is Info file ../info/emacs, produced by Makeinfo-1.55 from the
  2. input file emacs.texi.
  3.  
  4. 
  5. File: emacs,  Node: Tags Stepping,  Next: List Tags,  Prev: Tags Search,  Up: Tags
  6.  
  7. Stepping Through a Tags Table
  8. -----------------------------
  9.  
  10.    If you wish to process all the files in the selected tags table, but
  11. not in the specific ways that `M-x tags-search' and `M-x
  12. tags-query-replace' do, you can use `M-x next-file' to visit the files
  13. one by one.
  14.  
  15. `C-u M-x next-file'
  16.      Visit the first file in the tags table, and prepare to advance
  17.      sequentially by files.
  18.  
  19. `M-x next-file'
  20.      Visit the next file in the selected tags table.
  21.  
  22. 
  23. File: emacs,  Node: List Tags,  Prev: Tags Stepping,  Up: Tags
  24.  
  25. Tags Table Inquiries
  26. --------------------
  27.  
  28. `M-x list-tags RET FILE RET'
  29.      Display a list of the tags defined in the program file `file'.
  30.  
  31. `M-x tags-apropos RET REGEXP RET'
  32.      Display a list of all tags matching REGEXP.
  33.  
  34.    `M-x list-tags' reads the name of one of the files described by the
  35. selected tags table, and displays a list of all the tags defined in
  36. that file.  The "file name" argument is really just a string to compare
  37. against the file names recorded in the tags table; it is read as a
  38. string rather than as a file name.  Therefore, completion and
  39. defaulting are not available, and you must enter the file name the same
  40. way it appears in the tags table.  Do not include a directory as part of
  41. the file name unless the file name recorded in the tags table includes a
  42. directory.
  43.  
  44.    `M-x tags-apropos' is like `apropos' for tags (*note Apropos::.).
  45. It reads a regexp, then finds all the tags in the selected tags table
  46. whose entries match that regexp, and displays the tag names found.
  47.  
  48.    You can also perform completion in the buffer on the name space of
  49. tag names in the current tags tables.  *Note Symbol Completion::.
  50.  
  51. 
  52. File: emacs,  Node: Emerge,  Next: C Mode,  Prev: Tags,  Up: Programs
  53.  
  54. Merging Files with Emerge
  55. =========================
  56.  
  57.    It's not unusual for programmers to get their signals crossed and
  58. modify the same program in two different directions.  To recover from
  59. this confusion, you need to merge the two versions.  Emerge makes this
  60. easier.  See also *Note Comparing Files::.
  61.  
  62. * Menu:
  63.  
  64. * Overview of Emerge::        How to start Emerge.  Basic concepts.
  65. * Submodes of Emerge::      Fast mode vs. Edit mode.
  66.                   Skip Prefers mode and Auto Advance mode.
  67. * State of Difference::        You do the merge by specifying state A or B
  68.                   for each difference.
  69. * Merge Commands::        Commands for selecting a difference,
  70.                   changing states of differences, etc.
  71. * Exiting Emerge::        What to do when you've finished the merge.
  72. * Combining in Emerge::        How to keep both alternatives for a difference.
  73. * Fine Points of Emerge::   Misc.
  74.  
  75. 
  76. File: emacs,  Node: Overview of Emerge,  Next: Submodes of Emerge,  Up: Emerge
  77.  
  78. Overview of Emerge
  79. ------------------
  80.  
  81.    To start Emerge, run one of these four commands:
  82.  
  83. `M-x emerge-files'
  84.      Merge two specified files.
  85.  
  86. `M-x emerge-files-with-ancestor'
  87.      Merge two specified files, with reference to a common ancestor.
  88.  
  89. `M-x emerge-buffers'
  90.      Merge two buffers.
  91.  
  92. `M-x emerge-buffers-with-ancestor'
  93.      Merge two buffers with reference to a common ancestor in a third
  94.      buffer.
  95.  
  96.    The Emerge commands compare two files or buffers, and display the
  97. comparison in three buffers: one for each input text (the "A buffer"
  98. and the "B buffer"), and one (the "merge buffer") where merging takes
  99. place.  The merge buffer shows the full merged text, not just the
  100. differences.  Wherever the two input texts differ, you can choose which
  101. one of them to include in the merge buffer.
  102.  
  103.    The Emerge commands that take input from existing buffers use only
  104. the accessible portions of those buffers, if they are narrowed (*note
  105. Narrowing::.).
  106.  
  107.    If a common ancestor version is available, from which the two texts
  108. to be merged were both derived, Emerge can use it to guess which
  109. alternative is right.  Wherever one current version agrees with the
  110. ancestor, Emerge presumes that the other current version is a deliberate
  111. change which should be kept in the merged version.  Use the
  112. `with-ancestor' commands if you want to specify a common ancestor text.
  113. These commands read three file or buffer names--variant A, variant B,
  114. and the common ancestor.
  115.  
  116.    After the comparison is done and the buffers are prepared, the
  117. interactive merging starts.  You control the merging by typing special
  118. "merge commands" in the merge buffer.  The merge buffer shows you a
  119. full merged text, not just differences.  For each run of differences
  120. between the input texts, you can choose which one of them to keep, or
  121. edit them both together.
  122.  
  123.    The merge buffer uses a special major mode, Emerge mode, with
  124. commands for making these choices.  But you can also edit the buffer
  125. with ordinary Emacs commands.
  126.  
  127.    At any given time, the attention of Emerge is focused on one
  128. particular difference, called the "selected" difference.  This
  129. difference is marked off in the three buffers like this:
  130.  
  131.      vvvvvvvvvvvvvvvvvvvv
  132.      TEXT THAT DIFFERS
  133.      ^^^^^^^^^^^^^^^^^^^^
  134.  
  135. Emerge numbers all the differences sequentially and the mode line
  136. always shows the number of the selected difference.
  137.  
  138.    Normally, the merge buffer starts out with the A version of the text.
  139. But when the A version of a difference agrees with the common ancestor,
  140. then the B version is initially preferred for that difference.
  141.  
  142.    Emerge leaves the merged text in the merge buffer when you exit.  At
  143. that point, you can save it in a file with `C-x C-w'.  If you give a
  144. numeric argument to `emerge-files' or `emerge-files-with-ancestor', it
  145. reads the name of the output file using the minibuffer.  (This is the
  146. last file name those commands read.) Then exiting from Emerge saves the
  147. merged text in the output file.
  148.  
  149.    Normally, Emerge commands save the output buffer in its file when you
  150. exit.  If you abort Emerge with `C-]', the Emerge command does not save
  151. the output buffer, but you can save it yourself if you wish.
  152.  
  153. 
  154. File: emacs,  Node: Submodes of Emerge,  Next: State of Difference,  Prev: Overview of Emerge,  Up: Emerge
  155.  
  156. Submodes of Emerge
  157. ------------------
  158.  
  159.    You can choose between two modes for giving merge commands: Fast mode
  160. and Edit mode.  In Fast mode, basic merge commands are single
  161. characters, but ordinary Emacs commands are disabled.  This is
  162. convenient if you use only merge commands.  In Edit mode, all merge
  163. commands start with the prefix key `C-c C-c', and the normal Emacs
  164. commands are also available.  This allows editing the merge buffer, but
  165. slows down Emerge operations.
  166.  
  167.    Use `e' to switch to Edit mode, and `C-c C-c f' to switch to Fast
  168. mode.  The mode line indicates Edit and Fast modes with `E' and `F'.
  169.  
  170.    Emerge has two additional submodes that affect how particular merge
  171. commands work: Auto Advance mode and Skip Prefers mode.
  172.  
  173.    If Auto Advance mode is in effect, the `a' and `b' commands advance
  174. to the next difference.  This lets you go through the merge faster as
  175. long as you simply choose one of the alternatives from the input.  The
  176. mode line indicates Auto Advance mode with `A'.
  177.  
  178.    If Skip Prefers mode is in effect, the `n' and `p' commands skip
  179. over differences in states prefer-A and prefer-B (*note State of
  180. Difference::.).  Thus you see only differences for which neither version
  181. is presumed "correct".  The mode line indicates Skip Prefers mode with
  182. `S'.
  183.  
  184.    Use the command `s a' (`emerge-auto-advance-mode') to set or clear
  185. Auto Advance mode.  Use `s s' (`emerge-skip-prefers-mode') to set or
  186. clear Skip Prefers mode.  These commands turn on the mode with a
  187. positive argument, turns it off with a negative or zero argument, and
  188. toggle the mode with no argument.
  189.  
  190. 
  191. File: emacs,  Node: State of Difference,  Next: Merge Commands,  Prev: Submodes of Emerge,  Up: Emerge
  192.  
  193. State of a Difference
  194. ---------------------
  195.  
  196.    In the merge buffer, a difference is marked with lines of `v' and
  197. `^' characters.  Each difference has one of these seven states:
  198.  
  199. A
  200.      The difference is showing the A version.  The `a' command always
  201.      produces this state; the mode line indicates it with `A'.
  202.  
  203. B
  204.      The difference is showing the B version.  The `b' command always
  205.      produces this state; the mode line indicates it with `B'.
  206.  
  207. default-A
  208. default-B
  209.      The difference is showing the A or the B state by default, because
  210.      you haven't made a choice.  All differences start in the default-A
  211.      state (and thus the merge buffer is a copy of the A buffer),
  212.      except those for which one alternative is "preferred" (see below).
  213.  
  214.      When you select a difference, its state changes from default-A or
  215.      default-B to plain A or B.  Thus, the selected difference never has
  216.      state default-A or default-B, and these states are never displayed
  217.      in the mode line.
  218.  
  219.      The command `d a' chooses default-A as the default state, and `d
  220.      b' chooses default-B.  This chosen default applies to all
  221.      differences which you haven't ever selected and for which no
  222.      alternative is preferred.  If you are moving through the merge
  223.      sequentially, the differences you haven't selected are those
  224.      following the selected one.  Thus, while moving sequentially, you
  225.      can effectively make the A version the default for some sections
  226.      of the merge buffer and the B version the default for others by
  227.      using `d a' and `d b' between sections.
  228.  
  229. prefer-A
  230. prefer-B
  231.      The difference is showing the A or B state because it is
  232.      "preferred".  This means that you haven't made an explicit choice,
  233.      but one alternative seems likely to be right because the other
  234.      alternative agrees with the common ancestor.  Thus, where the A
  235.      buffer agrees with the common ancestor, the B version is
  236.      preferred, because chances are it is the one that was actually
  237.      changed.
  238.  
  239.      These two states are displayed in the mode line as `A*' and `B*'.
  240.  
  241. combined
  242.      The difference is showing a combination of the A and B states, as a
  243.      result of the `x c' or `x C' commands.
  244.  
  245.      Once a difference is in this state, the `a' and `b' commands don't
  246.      do anything to it unless you give them a numeric argument.
  247.  
  248.      The mode line displays this state as `comb'.
  249.  
  250. 
  251. File: emacs,  Node: Merge Commands,  Next: Exiting Emerge,  Prev: State of Difference,  Up: Emerge
  252.  
  253. Merge Commands
  254. --------------
  255.  
  256.    Here are the Merge commands for Fast mode; in Edit mode, precede them
  257. with `C-c C-c':
  258.  
  259. `p'
  260.      Select the previous difference.
  261.  
  262. `n'
  263.      Select the next difference.
  264.  
  265. `a'
  266.      Choose the A version of this difference.
  267.  
  268. `b'
  269.      Choose the B version of this difference.
  270.  
  271. `C-u N j'
  272.      Select difference number N.
  273.  
  274. `.'
  275.      Select the difference containing point.  You can use this command
  276.      in the merge buffer or in the A or B buffer.
  277.  
  278. `q'
  279.      Quit--finish the merge.
  280.  
  281. `C-]'
  282.      Abort--exit merging and do not save the output.
  283.  
  284. `f'
  285.      Go into Fast mode.  (In Edit mode, this is actually `C-c C-c f'.)
  286.  
  287. `e'
  288.      Go into Edit mode.
  289.  
  290. `l'
  291.      Recenter (like `C-l') all three windows.
  292.  
  293. `-'
  294.      Specify part of a prefix numeric argument.
  295.  
  296. `DIGIT'
  297.      Also specify part of a prefix numeric argument.
  298.  
  299. `d a'
  300.      Choose the A version as the default from here down in the merge
  301.      buffer.
  302.  
  303. `d b'
  304.      Choose the B version as the default from here down in the merge
  305.      buffer.
  306.  
  307. `c a'
  308.      Copy the A version of this difference into the kill ring.
  309.  
  310. `c b'
  311.      Copy the B version of this difference into the kill ring.
  312.  
  313. `i a'
  314.      Insert the A version of this difference at point.
  315.  
  316. `i b'
  317.      Insert the B version of this difference at point.
  318.  
  319. `m'
  320.      Put point and mark around the difference.
  321.  
  322. `^'
  323.      Scroll all three windows down (like `M-v').
  324.  
  325. `v'
  326.      Scroll all three windows up (like `C-v').
  327.  
  328. `<'
  329.      Scroll all three windows left (like `C-x <').
  330.  
  331. `>'
  332.      Scroll all three windows right (like `C-x >').
  333.  
  334. `|'
  335.      Reset horizontal scroll on all three windows.
  336.  
  337. `x 1'
  338.      Shrink the merge window to one line.  (Use `C-u l' to restore it
  339.      to full size.)
  340.  
  341. `x c'
  342.      Combine the two versions of this difference (*note Combining in
  343.      Emerge::.).
  344.  
  345. `x f'
  346.      Show the names of the files/buffers Emerge is operating on, in a
  347.      Help window.  (Use `C-u l' to restore windows.)
  348.  
  349. `x j'
  350.      Join this difference with the following one.  (`C-u x j' joins
  351.      this difference with the previous one.)
  352.  
  353. `x s'
  354.      Split this difference into two differences.  Before you use this
  355.      command, position point in each of the three buffers at the place
  356.      where you want to split the difference.
  357.  
  358. `x t'
  359.      Trim identical lines off top and bottom of the difference.  Such
  360.      lines occur when the A and B versions are identical but differ
  361.      from the ancestor version.
  362.  
  363. 
  364. File: emacs,  Node: Exiting Emerge,  Next: Combining in Emerge,  Prev: Merge Commands,  Up: Emerge
  365.  
  366. Exiting Emerge
  367. --------------
  368.  
  369.    The `q' command (`emerge-quit') finishes the merge, storing the
  370. results into the output file if you specified one.  It restores the A
  371. and B buffers to their proper contents, or kills them if they were
  372. created by Emerge and you haven't changed them.  It also disables the
  373. Emerge commands in the merge buffer, since executing them later could
  374. damage the contents of the various buffers.
  375.  
  376.    `C-]' aborts the merge.  This means exiting without writing the
  377. output file.  If you didn't specify an output file, then there is no
  378. real difference between aborting and finishing the merge.
  379.  
  380.    If the Emerge command was called from another Lisp program, then its
  381. return value is `t' for successful completion, or `nil' if you abort.
  382.  
  383. 
  384. File: emacs,  Node: Combining in Emerge,  Next: Fine Points of Emerge,  Prev: Exiting Emerge,  Up: Emerge
  385.  
  386. Combining the Two Versions
  387. --------------------------
  388.  
  389.    Sometimes you want to keep *both* alternatives for a particular
  390. difference.  To do this, use `x c', which edits the merge buffer like
  391. this:
  392.  
  393.      #ifdef NEW
  394.      VERSION FROM A BUFFER
  395.      #else /* NEW */
  396.      VERSION FROM B BUFFER
  397.      #endif /* NEW */
  398.  
  399. While this example shows C preprocessor conditionals delimiting the two
  400. alternative versions, you can specify the strings to use by setting the
  401. variable `emerge-combine-versions-template' to a string of your choice.
  402. In the string, `%a' says where to put version A, and `%b' says where
  403. to put version B.  The default setting, which produces the results
  404. shown above, looks like this:
  405.  
  406.      "#ifdef NEW\n%a#else /* NEW */\n%b#endif /* NEW */\n"
  407.  
  408. 
  409. File: emacs,  Node: Fine Points of Emerge,  Prev: Combining in Emerge,  Up: Emerge
  410.  
  411. Fine Points of Emerge
  412. ---------------------
  413.  
  414.    During the merge, you mustn't try to edit the A and B buffers
  415. yourself.  Emerge modifies them temporarily, but ultimately puts them
  416. back the way they were.
  417.  
  418.    You can have any number of merges going at once--just don't use any
  419. one buffer as input to more than one merge at once, since the temporary
  420. changes made in these buffers would get in each other's way.
  421.  
  422.    Starting Emerge can take a long time because it needs to compare the
  423. files fully.  Emacs can't do anything else until `diff' finishes.
  424. Perhaps in the future someone will change Emerge to do the comparison in
  425. the background when the input files are large--then you could keep on
  426. doing other things with Emacs until Emerge gets ready to accept
  427. commands.
  428.  
  429.    After setting up the merge, Emerge runs the hook
  430. `emerge-startup-hook' (*note Hooks::.).
  431.  
  432. 
  433. File: emacs,  Node: C Mode,  Next: Fortran,  Prev: Emerge,  Up: Programs
  434.  
  435. C Mode
  436. ======
  437.  
  438.    In addition to the facilities of typical programming language major
  439. modes (*note Program Modes::.), C mode has various special facilities.
  440.  
  441. `M-a'
  442. `M-e'
  443.      In C mode, `M-a' and `M-e' move by complete C statements
  444.      (`c-beginning-of-statement' and `c-end-of-statement').  These
  445.      commands do ordinary, textual sentence motion when in or next to a
  446.      comment.
  447.  
  448. `M-q'
  449.      `M-q' in C mode runs `c-fill-paragraph', which is designed for
  450.      filling C comments.  (We assume you don't want to fill the actual
  451.      C code in a C program.)
  452.  
  453. `C-c C-u'
  454.      Move back to the containing preprocessor conditional, setting the
  455.      mark at the starting point (`c-up-conditional').
  456.  
  457.      A numeric argument acts as a repeat count.  With a negative
  458.      argument, this command moves forward to the end of the containing
  459.      preprocessor conditional.  When going backwards, `#elif' acts like
  460.      `#else' followed by `#if'.  When going forwards, `#elif' is
  461.      ignored.
  462.  
  463. `C-c C-n'
  464.      Move forward across the next preprocessor conditional, setting the
  465.      mark at the starting point (`c-forward-conditional').
  466.  
  467. `C-c C-p'
  468.      Move backward across the previous preprocessor conditional,
  469.      setting the at the starting point (`c-backward-conditional').
  470.  
  471. `M-x c-macro-expand'
  472.      When you are debugging C code that uses macros, sometimes it is
  473.      hard to figure out precisely how the macros expand.  The command
  474.      `M-x c-macro-expand' runs the C preprocessor and shows you what
  475.      expansion results from the region.  The portion of the buffer
  476.      before the region is also included in preprocessing, for the sake
  477.      of macros defined there, but the output from this part isn't shown.
  478.  
  479. `M-x c-backslash-region'
  480.      Insert or align `\' characters at the ends of the lines of the
  481.      region, except for the last such line.  This is useful after
  482.      writing or editing a C macro definition.
  483.  
  484.      If a line already ends in `\', this command adjusts the amount of
  485.      whitespace before it.  Otherwise, it inserts a new `\'.
  486.  
  487. `M-x cpp-highlight-buffer'
  488.      Highlight parts of the text according to its preprocessor
  489.      conditionals.  This command displays another buffer named `*CPP
  490.      Edit*', which serves as a graphic menu for selecting how to
  491.      display particular kinds of conditionals and their contents.
  492.      After changing various settings, click on `[A]pply these settings'
  493.      (or go to that buffer and type `a') to rehighlight the C mode
  494.      buffer accordingly.
  495.  
  496.    C++ mode is like C mode, except that it understands C++ comment
  497. syntax and certain other differences between C and C++.  It also has a
  498. command `M-x fill-c++-comment', which fills a paragraph made of C++
  499. comment lines.
  500.  
  501.    The command `comment-region' is useful in C++ mode for commenting
  502. out several consecutive lines, or removing the commenting out of such
  503. lines.  (You don't need this command with C comment syntax because you
  504. don't need to put comment delimiters on each line.)  *Note Comments::.
  505.  
  506. 
  507. File: emacs,  Node: Fortran,  Next: Asm Mode,  Prev: C Mode,  Up: Programs
  508.  
  509. Fortran Mode
  510. ============
  511.  
  512.    Fortran mode provides special motion commands for Fortran statements
  513. and subprograms, and indentation commands that understand Fortran
  514. conventions of nesting, line numbers and continuation statements.
  515. Fortran mode has its own Auto Fill mode that breaks long lines into
  516. proper Fortran continuation lines.
  517.  
  518.    Special commands for comments are provided because Fortran comments
  519. are unlike those of other languages.  Built-in abbrevs optionally save
  520. typing when you insert Fortran keywords.
  521.  
  522.    Use `M-x fortran-mode' to switch to this major mode.  This command
  523. runs the hook `fortran-mode-hook' (*note Hooks::.).
  524.  
  525. * Menu:
  526.  
  527. * Motion: Fortran Motion.     Moving point by statements or subprograms.
  528. * Indent: Fortran Indent.     Indentation commands for Fortran.
  529. * Comments: Fortran Comments.     Inserting and aligning comments.
  530. * Autofill: Fortran Autofill.     Auto fill minor mode for Fortran.
  531. * Columns: Fortran Columns.     Measuring columns for valid Fortran.
  532. * Abbrev: Fortran Abbrev.     Built-in abbrevs for Fortran keywords.
  533.  
  534. 
  535. File: emacs,  Node: Fortran Motion,  Next: Fortran Indent,  Up: Fortran
  536.  
  537. Motion Commands
  538. ---------------
  539.  
  540.    Fortran mode provides special commands to move by subprograms
  541. (functions and subroutines) and by statements.  There is also a command
  542. to put the region around one subprogram, convenient for killing it or
  543. moving it.
  544.  
  545. `C-M-a'
  546.      Move to beginning of subprogram
  547.      (`beginning-of-fortran-subprogram').
  548.  
  549. `C-M-e'
  550.      Move to end of subprogram (`end-of-fortran-subprogram').
  551.  
  552. `C-M-h'
  553.      Put point at beginning of subprogram and mark at end
  554.      (`mark-fortran-subprogram').
  555.  
  556. `C-c C-n'
  557.      Move to beginning of current or next statement
  558.      (`fortran-next-statement').
  559.  
  560. `C-c C-p'
  561.      Move to beginning of current or previous statement
  562.      (`fortran-previous-statement').
  563.  
  564. 
  565. File: emacs,  Node: Fortran Indent,  Next: Fortran Comments,  Prev: Fortran Motion,  Up: Fortran
  566.  
  567. Fortran Indentation
  568. -------------------
  569.  
  570.    Special commands and features are needed for indenting Fortran code
  571. in order to make sure various syntactic entities (line numbers, comment
  572. line indicators and continuation line flags) appear in the columns that
  573. are required for standard Fortran.
  574.  
  575. * Menu:
  576.  
  577. * Commands: ForIndent Commands.  Commands for indenting Fortran.
  578. * Contline: ForIndent Cont.      How continuation lines indent.
  579. * Numbers:  ForIndent Num.       How line numbers auto-indent.
  580. * Conv:     ForIndent Conv.      Conventions you must obey to avoid trouble.
  581. * Vars:     ForIndent Vars.      Variables controlling Fortran indent style.
  582.  
  583. 
  584. File: emacs,  Node: ForIndent Commands,  Next: ForIndent Cont,  Up: Fortran Indent
  585.  
  586. Fortran Indentation Commands
  587. ............................
  588.  
  589. `TAB'
  590.      Indent the current line (`fortran-indent-line').
  591.  
  592. `LFD'
  593.      Indent the current and start a new indented line
  594.      (`fortran-indent-new-line').
  595.  
  596. `M-LFD'
  597.      Break the current line and set up a continuation line.
  598.  
  599. `C-M-q'
  600.      Indent all the lines of the subprogram point is in
  601.      (`fortran-indent-subprogram').
  602.  
  603.    Fortran mode redefines TAB to reindent the current line for Fortran
  604. (`fortran-indent-line').  This command indents Line numbers and
  605. continuation markers to their required columns, and independently
  606. indents the body of the statement based on its nesting in the program.
  607.  
  608.    The key `LFD' runs the command `fortran-indent-new-line', which
  609. reindents the current line then makes and indents a new line.  This
  610. command is useful to reindent the closing statement of `do' loops and
  611. other blocks before starting a new line.
  612.  
  613.    The key `C-M-q' runs `fortran-indent-subprogram', a command to
  614. reindent all the lines of the Fortran subprogram (function or
  615. subroutine) containing point.
  616.  
  617.    The key `M-LFD' runs `fortran-split-line', which splits a line in
  618. the appropriate fashion for Fortran.  In a non-comment line, the second
  619. half becomes a continuation line and is indented accordingly.  In a
  620. comment line, both halves become separate comment lines.
  621.  
  622. 
  623. File: emacs,  Node: ForIndent Cont,  Next: ForIndent Num,  Prev: ForIndent Commands,  Up: Fortran Indent
  624.  
  625. Continuation Lines
  626. ..................
  627.  
  628.    Most modern Fortran compilers allow two ways of writing continuation
  629. lines.  If the first non-space character on a line is in column 5, then
  630. that line is a continuation of the previous line.  We call this "fixed
  631. format".  (In GNU Emacs we always count columns from 0.)  The variable
  632. `fortran-continuation-string' specifies what character to put on column
  633. 5.  A line that starts with a tab character followed by any digit
  634. except `0' is also a continuation line.  We call this style of
  635. continuation "tab format".
  636.  
  637.    Fortran mode can make either style of continuation line, but you
  638. must specify which one you prefer.  The value of the variable
  639. `indent-tabs-mode' controls the choice: `nil' for fixed format, and
  640. non-`nil' for tab format.  You can tell which style is presently in
  641. effect by the presence or absence of the string `Tab' in the mode line.
  642.  
  643.    If the text on a line starts with the conventional Fortran
  644. continuation marker `$', or if it begins with any non-whitespace
  645. character in column 5, Fortran mode treats it as a continuation line.
  646. When you indent a continuation line with TAB, it converts the line to
  647. the current continuation style.  When you split a Fortran statement
  648. with `M-LFD', the continuation marker on the newline is created
  649. according to the continuation style.
  650.  
  651.    The setting of continuation style affects several other aspects of
  652. editing in Fortran mode.  In fixed format mode, the minimum column
  653. number for the body of a statement is 6.  Lines inside of Fortran
  654. blocks that are indented to larger column numbers always use only the
  655. space character for whitespace.  In tab format mode, the minimum column
  656. number for the statement body is 8, and the whitespace before column 8
  657. must always consist of one tab character.
  658.  
  659.    When you enter Fortran mode for an existing file, it tries to deduce
  660. the proper continuation style automatically from the file contents.
  661. The first line that begins with either a tab character or six spaces
  662. determines the choice.  The variable `fortran-analyze-depth' specifies
  663. how many lines to consider (at the beginning of the file); if none of
  664. those lines indicates a style, then the variable
  665. `fortran-tab-mode-default' specifies the style.  If it is `nil', that
  666. specifies fixed format, and non-`nil' specifies tab format.
  667.  
  668. 
  669. File: emacs,  Node: ForIndent Num,  Next: ForIndent Conv,  Prev: ForIndent Cont,  Up: Fortran Indent
  670.  
  671. Line Numbers
  672. ............
  673.  
  674.    If a number is the first non-whitespace in the line, Fortran
  675. indentation assumes it is a line number and moves it to columns 0
  676. through 4.  (Columns always count from 0 in GNU Emacs.)
  677.  
  678.    Line numbers of four digits or less are normally indented one space.
  679. The variable `fortran-line-number-indent' controls this; it specifies
  680. the maximum indentation a line number can have.  Line numbers are
  681. indented to right-justify them to end in column 4 unless that would
  682. require more than this maximum indentation.  The default value of the
  683. variable is 1.
  684.  
  685.    Simply inserting a line number is enough to indent it according to
  686. these rules.  As each digit is inserted, the indentation is recomputed.
  687. To turn off this feature, set the variable
  688. `fortran-electric-line-number' to `nil'.  Then inserting line numbers
  689. is like inserting anything else.
  690.  
  691. 
  692. File: emacs,  Node: ForIndent Conv,  Next: ForIndent Vars,  Prev: ForIndent Num,  Up: Fortran Indent
  693.  
  694. Syntactic Conventions
  695. .....................
  696.  
  697.    Fortran mode assumes that you follow certain conventions that
  698. simplify the task of understanding a Fortran program well enough to
  699. indent it properly:
  700.  
  701.    * Two nested `do' loops never share a `continue' statement.
  702.  
  703.    * Fortran keywords such as `if', `else', `then', `do' and others are
  704.      written without embedded whitespace or line breaks.
  705.  
  706.      Fortran compilers generally ignore whitespace outside of string
  707.      constants, but Fortran mode does not recognize these keywords if
  708.      they are not contiguous.  Constructs such as `else if' or `end do'
  709.      are acceptable, but the second word should be on the same line as
  710.      the first and not on a continuation line.
  711.  
  712. If you fail to follow these conventions, the indentation commands may
  713. indent some lines unaesthetically.  However, a correct Fortran program
  714. retains its meaning when reindented even if the conventions are not
  715. followed.
  716.  
  717. 
  718. File: emacs,  Node: ForIndent Vars,  Prev: ForIndent Conv,  Up: Fortran Indent
  719.  
  720. Variables for Fortran Indentation
  721. .................................
  722.  
  723.    Several additional variables control how Fortran indentation works:
  724.  
  725. `fortran-do-indent'
  726.      Extra indentation within each level of `do' statement (default 3).
  727.  
  728. `fortran-if-indent'
  729.      Extra indentation within each level of `if' statement (default 3).
  730.      This value is also used for extra indentation within each level of
  731.      the Fortran 90 `where' statement.
  732.  
  733. `fortran-structure-indent'
  734.      Extra indentation within each level of `structure', `union', or
  735.      `map' statements (default 3).
  736.  
  737. `fortran-continuation-indent'
  738.      Extra indentation for bodies of continuation lines (default 5).
  739.  
  740. `fortran-check-all-num-for-matching-do'
  741.      If this is `nil', indentation assumes that each `do' statement
  742.      ends on a `continue' statement.  Therefore, when computing
  743.      indentation for a statement other than `continue', it can save time
  744.      by not checking for a `do' statement ending there.  If this is
  745.      non-`nil', indenting any numbered statement must check for a `do'
  746.      that ends there.  The default is `nil'.
  747.  
  748. `fortran-blink-matching-if'
  749.      If this is `t', indenting an `endif' statement moves the cursor
  750.      momentarily to the matching `if' statement to show where it is.
  751.      The default is `nil'.
  752.  
  753. `fortran-minimum-statement-indent-fixed'
  754.      Minimum indentation for fortran statements when using fixed format
  755.      continuation line style.  Statement bodies are never indented less
  756.      than this much.  The default is 6.
  757.  
  758. `fortran-minimum-statement-indent-tab'
  759.      Minimum indentation for fortran statements for tab format
  760.      continuation line style.  Statement bodies are never indented less
  761.      than this much.  The default is 8.
  762.  
  763. 
  764. File: emacs,  Node: Fortran Comments,  Next: Fortran Autofill,  Prev: Fortran Indent,  Up: Fortran
  765.  
  766. Fortran Comments
  767. ----------------
  768.  
  769.    The usual Emacs comment commands assume that a comment can follow a
  770. line of code.  In Fortran, the standard comment syntax requires an
  771. entire line to be just a comment.  Therefore, Fortran mode replaces the
  772. standard Emacs comment commands and defines some new variables.
  773.  
  774.    Fortran mode can also handle a nonstandard comment syntax where
  775. comments start with `!' and can follow other text.  Because only some
  776. Fortran compilers accept this syntax, Fortran mode will not insert such
  777. comments unless you have said in advance to do so.  To do this, set the
  778. variable `comment-start' to `"!"' (*note Variables::.).
  779.  
  780. `M-;'
  781.      Align comment or insert new comment (`fortran-comment-indent').
  782.  
  783. `C-x ;'
  784.      Applies to nonstandard `!' comments only.
  785.  
  786. `C-c ;'
  787.      Turn all lines of the region into comments, or (with argument)
  788.      turn them back into real code (`fortran-comment-region').
  789.  
  790.    `M-;' in Fortran mode is redefined as the command
  791. `fortran-comment-indent'.  Like the usual `M-;' command, this
  792. recognizes any kind of existing comment and aligns its text
  793. appropriately; if there is no existing comment, a comment is inserted
  794. and aligned.  But inserting and aligning comments are not the same in
  795. Fortran mode as in other modes.
  796.  
  797.    When a new comment must be inserted, if the current line is blank, a
  798. full-line comment is inserted.  On a non-blank line, a nonstandard `!'
  799. comment is inserted if you have said you want to use them.  Otherwise a
  800. full-line comment is inserted on a new line before the current line.
  801.  
  802.    Nonstandard `!' comments are aligned like comments in other
  803. languages, but full-line comments are different.  In a standard
  804. full-line comment, the comment delimiter itself must always appear in
  805. column zero.  What can be aligned is the text within the comment.  You
  806. can choose from three styles of alignment by setting the variable
  807. `fortran-comment-indent-style' to one of these values:
  808.  
  809. `fixed'
  810.      Align the text at a fixed column, which is the sum of
  811.      `fortran-comment-line-extra-indent' and the minimum statement
  812.      indentation.  This is the default.
  813.  
  814.      The minimum statement indentation is
  815.      `fortran-minimum-statement-indent-fixed' for fixed format
  816.      continuation line style and `fortran-minimum-statement-indent-tab'
  817.      for tab format style.
  818.  
  819. `relative'
  820.      Align the text as if it were a line of code, but with an additional
  821.      `fortran-comment-line-extra-indent' columns of indentation.
  822.  
  823. `nil'
  824.      Don't move text in full-line columns automatically at all.
  825.  
  826.    In addition, you can specify the character to be used to indent
  827. within full-line comments by setting the variable
  828. `fortran-comment-indent-char' to the single-character string you want
  829. to use.
  830.  
  831.    Fortran mode introduces two variables `comment-line-start' and
  832. `comment-line-start-skip' which play for full-line comments the same
  833. roles played by `comment-start' and `comment-start-skip' for ordinary
  834. text-following comments.  Normally these are set properly by Fortran
  835. mode so you do not need to change them.
  836.  
  837.    The normal Emacs comment command `C-x ;' has not been redefined.  If
  838. you use `!' comments, this command can be used with them.  Otherwise it
  839. is useless in Fortran mode.
  840.  
  841.    The command `C-c ;' (`fortran-comment-region') turns all the lines
  842. of the region into comments by inserting the string `C$$$' at the front
  843. of each one.  With a numeric argument, it turns the region back into
  844. live code by deleting `C$$$' from the front of each line in it.  The
  845. string used for these comments can be controlled by setting the
  846. variable `fortran-comment-region'.  Note that here we have an example
  847. of a command and a variable with the same name; these two uses of the
  848. name never conflict because in Lisp and in Emacs it is always clear
  849. from the context which one is meant.
  850.  
  851. 
  852. File: emacs,  Node: Fortran Autofill,  Next: Fortran Columns,  Prev: Fortran Comments,  Up: Fortran
  853.  
  854. Fortran Auto Fill Mode
  855. ----------------------
  856.  
  857.    Fortran Auto Fill mode is a minor mode which automatically splits
  858. Fortran statements as you insert them when they become too wide.
  859. Splitting a statement involves making continuation lines using
  860. `fortran-continuation-string' (*Note ForIndent Cont::).  This splitting
  861. happens when you type SPC, RET, or TAB, and also in the Fortran
  862. indentation commands.
  863.  
  864.    `M-x fortran-auto-fill-mode' turns Fortran Auto Fill mode on if it
  865. was off, or off if it was on.  This command works the same as `M-x
  866. auto-fill-mode' does for normal Auto Fill mode (*note Filling::.).  A
  867. positive numeric argument turns Fortran Auto Fill mode on, and a
  868. negative argument turns it off.  You can see when Fortran Auto Fill mode
  869. is in effect by the presence of the word `Fill' in the mode line,
  870. inside the parentheses.  Fortran Auto Fill mode is a minor mode, turned
  871. on or off for each buffer individually.  *Note Minor Modes::.
  872.  
  873.    Fortran Auto Fill mode breaks lines at spaces or delimiters when the
  874. lines get longer than the desired width (the value of `fill-column').
  875. The delimiters that Fortran Auto Fill mode may break at are `,', `'',
  876. `+', `-', `/', `*', `=', and `)'.  The line break comes after the
  877. delimiter if the variable `fortran-break-before-delimiters' is `nil'.
  878. Otherwise (and by default), the break comes before the delimiter.
  879.  
  880.    By default, Fortran Auto Fill mode is not enabled.  If you want this
  881. feature turned on permanently, add a hook function to
  882. `fortran-mode-hook' to execute `(fortran-auto-fill-mode 1)'.  *Note
  883. Hooks::.
  884.  
  885. 
  886. File: emacs,  Node: Fortran Columns,  Next: Fortran Abbrev,  Prev: Fortran Autofill,  Up: Fortran
  887.  
  888. Checking Columns in Fortran
  889. ---------------------------
  890.  
  891. `C-c C-r'
  892.      Display a "column ruler" momentarily above the current line
  893.      (`fortran-column-ruler').
  894.  
  895. `C-c C-w'
  896.      Split the current window horizontally temporarily so that it is 72
  897.      columns wide.  This may help you avoid making lines longer than
  898.      the 72 character limit that some fortran compilers impose
  899.      (`fortran-window-create-momentarily').
  900.  
  901.    The command `C-c C-r' (`fortran-column-ruler') shows a column ruler
  902. momentarily above the current line.  The comment ruler is two lines of
  903. text that show you the locations of columns with special significance in
  904. Fortran programs.  Square brackets show the limits of the columns for
  905. line numbers, and curly brackets show the limits of the columns for the
  906. statement body.  Column numbers appear above them.
  907.  
  908.    Note that the column numbers count from zero, as always in GNU Emacs.
  909. As a result, the numbers may be one less than those you are familiar
  910. with; but the positions they indicate in the line are standard for
  911. Fortran.
  912.  
  913.    The text used to display the column ruler depends on the value of
  914. the variable `indent-tabs-mode'.  If `indent-tabs-mode' is `nil', then
  915. the value of the variable `fortran-column-ruler-fixed' is used as the
  916. column ruler.  Otherwise, the variable `fortran-column-ruler-tab' is
  917. displayed.  By changing these variables, you can change the column
  918. ruler display.
  919.  
  920.    For even more help, use `C-c C-w' (`fortran-window-create'), a
  921. command which splits the current window horizontally, making a window 72
  922. columns wide.  By editing in this window you can immediately see when
  923. you make a line too wide to be correct Fortran.
  924.  
  925. 
  926. File: emacs,  Node: Fortran Abbrev,  Prev: Fortran Columns,  Up: Fortran
  927.  
  928. Fortran Keyword Abbrevs
  929. -----------------------
  930.  
  931.    Fortran mode provides many built-in abbrevs for common keywords and
  932. declarations.  These are the same sort of abbrev that you can define
  933. yourself.  To use them, you must turn on Abbrev mode.  *Note Abbrevs::.
  934.  
  935.    The built-in abbrevs are unusual in one way: they all start with a
  936. semicolon.  You cannot normally use semicolon in an abbrev, but Fortran
  937. mode makes this possible by changing the syntax of semicolon to "word
  938. constituent."
  939.  
  940.    For example, one built-in Fortran abbrev is `;c' for `continue'.  If
  941. you insert `;c' and then insert a punctuation character such as a space
  942. or a newline, the `;c' expands automatically to `continue', provided
  943. Abbrev mode is enabled.
  944.  
  945.    Type `;?' or `;C-h' to display a list of all the built-in Fortran
  946. abbrevs and what they stand for.
  947.  
  948. 
  949. File: emacs,  Node: Asm Mode,  Prev: Fortran,  Up: Programs
  950.  
  951. Asm Mode
  952. ========
  953.  
  954.    Asm mode is a major mode for editing files of assembler code.  It
  955. defines these commands:
  956.  
  957. `TAB'
  958.      `tab-to-tab-stop'.
  959.  
  960. `LFD'
  961.      Insert a newline and then indent using `tab-to-tab-stop'.
  962.  
  963. `:'
  964.      Insert a colon and then remove the indentation from before the
  965.      label preceding colon.  Then do `tab-to-tab-stop'.
  966.  
  967. `;'
  968.      Insert or align a comment.
  969.  
  970.    The variable `asm-comment-char' specifies which character starts
  971. comments in assembler syntax.
  972.  
  973. 
  974. File: emacs,  Node: Building,  Next: Abbrevs,  Prev: Programs,  Up: Top
  975.  
  976. Compiling and Testing Programs
  977. ******************************
  978.  
  979.    The previous chapter discusses the Emacs commands that are useful for
  980. making changes in programs.  This chapter deals with commands that
  981. assist in the larger process of developing and maintaining programs.
  982.  
  983. * Menu:
  984.  
  985. * Compilation::                   Compiling programs in languages other
  986.                                     than Lisp (C, Pascal, etc.)
  987. * Debuggers::                      Running symbolic debuggers for
  988.                                     non-Lisp programs.
  989. * Executing Lisp::                Various modes for editing Lisp programs,
  990.                                     with different facilities for running
  991.                                     the Lisp programs.
  992. * Libraries: Lisp Libraries.      Creating Lisp programs to run in Emacs.
  993. * Interaction: Lisp Interaction.  Executing Lisp in an Emacs buffer.
  994. * Eval: Lisp Eval.                Executing a single Lisp expression in Emacs.
  995. * External Lisp::                 Communicating through Emacs with a
  996.                                     separate Lisp.
  997.  
  998. 
  999. File: emacs,  Node: Compilation,  Next: Debuggers,  Up: Building
  1000.  
  1001. Running Compilations under Emacs
  1002. ================================
  1003.  
  1004.    Emacs can run compilers for noninteractive languages such as C and
  1005. Fortran as inferior processes, feeding the error log into an Emacs
  1006. buffer.  It can also parse the error messages and show you the source
  1007. lines where compilation errors occurred.
  1008.  
  1009. `M-x compile'
  1010.      Run a compiler asynchronously under Emacs, with error messages to
  1011.      `*compilation*' buffer.
  1012.  
  1013. `M-x grep'
  1014.      Run `grep' asynchronously under Emacs, with matching lines listed
  1015.      in the buffer named `*grep*'.
  1016.  
  1017. `M-x kill-compilation'
  1018. `M-x kill-grep'
  1019.      Kill the running compilation or `grep' subprocess.
  1020.  
  1021. `C-x `'
  1022.      Visit the locus of the next compiler error message or `grep' match.
  1023.  
  1024. `RET'
  1025.      Visit the locus of the error message that point is on.  This
  1026.      command is used in the compilation buffer.
  1027.  
  1028. `Mouse-2'
  1029.      Visit the locus of the error message that you click on.
  1030.  
  1031.    To run `make' or another compilation command, do `M-x compile'.
  1032. This command reads a shell command line using the minibuffer, and then
  1033. executes the command in an inferior shell, putting output in the buffer
  1034. named `*compilation*'.  The current buffer's default directory is used
  1035. as the working directory for the execution of the command; normally,
  1036. therefore, the compilation happens in this directory.
  1037.  
  1038.    When the shell command line is read, the minibuffer appears
  1039. containing a default command line, which is the command you used the
  1040. last time you did `M-x compile'.  If you type just RET, the same command
  1041. line is used again.  For the first `M-x compile', the default is `make
  1042. -k'.  The default compilation command comes from the variable
  1043. `compile-command'; if the appropriate compilation command for a file is
  1044. something other than `make -k', it can be useful for the file to
  1045. specify a local value for `compile-command' (*note File Variables::.).
  1046.  
  1047.    Starting a compilation displays the buffer `*compilation*' in
  1048. another window but does not select it.  The buffer's mode line tells you
  1049. whether compilation is finished, with the word `run' or `exit' inside
  1050. the parentheses.  You do not have to keep this buffer visible;
  1051. compilation continues in any case.  While a compilation is going on, the
  1052. string `Compiling' appears in the mode lines of all windows.  When this
  1053. string disappears, the compilation is finished.
  1054.  
  1055.    To kill the compilation process, do `M-x kill-compilation'.  When
  1056. the compiler process terminates, the mode line of the `*compilation*'
  1057. buffer changes to say `signal' instead of `run'.  Starting a new
  1058. compilation also kills any running compilation, as only one can exist
  1059. at any time.  However, `M-x compile' asks for confirmation before
  1060. actually killing a compilation that is running.
  1061.  
  1062.    The `*compilation*' buffer uses a special major mode, Compilation
  1063. mode.  This mode provides the keys SPC and DEL to scroll by screenfuls,
  1064. and `M-n' and `M-p' to move to the next or previous error message.  You
  1065. can also use `M-{' and `M-}' to move up or down to an error message for
  1066. a different source file.
  1067.  
  1068.    You can visit the source for any particular error message by moving
  1069. point in `*compilation*' to that error message and typing RET
  1070. (`compile-goto-error').  Or click `Mouse-2' on the error message; you
  1071. need not switch to the `*compilation*' buffer first.
  1072.  
  1073.    To parse the compiler error messages sequentially, type `C-x `'
  1074. (`next-error').  The character following the `C-x' is the backquote or
  1075. "grave accent," not the single-quote.  This command is available in all
  1076. buffers, not just in `*compilation*'; it displays the next error
  1077. message at the top of one window and source location of the error in
  1078. another window.
  1079.  
  1080.    The first time `C-x `' is used after the start of a compilation, it
  1081. moves to the first error's location.  Subsequent uses of `C-x `'
  1082. advance down to subsequent errors.  If you visit a specific error
  1083. message with RET or `Mouse-2', subsequent `C-x `' commands advance from
  1084. there.  When `C-x `' gets to the end of the buffer and finds no more
  1085. error messages to visit, it fails and signals an Emacs error.
  1086.  
  1087.    `C-u C-x `' starts scanning from the beginning of the compilation
  1088. buffer.  This way, you can process the same set of errors again.
  1089.  
  1090.    Just as you can run a compiler, you can also run `grep' and then
  1091. visit the lines on which matches were found.  To do this, type `M-x
  1092. grep' with an argument line that contains the same arguments you would
  1093. give `grep' when running it normally: a `grep'-style regexp (usually in
  1094. single-quotes to quote the shell's special characters) followed by file
  1095. names which may use wildcards.  The output from `grep' goes in the
  1096. `*grep*' buffer, and you can find the matching lines in the source with
  1097. `C-x `' and RET just like compiler errors.
  1098.  
  1099.    Note: a shell is used to run the compile command, but the shell is
  1100. told that it should be noninteractive.  This means in particular that
  1101. the shell starts up with no prompt.  If you find your usual shell prompt
  1102. making an unsightly appearance in the `*compilation*' buffer, it means
  1103. you have made a mistake in your shell's init file by setting the prompt
  1104. unconditionally.  (The init file name may be `.profile', `.cshrc',
  1105. `.shrc', or various other things, depending on the shell you use.)  The
  1106. shell init file should set the prompt only if there already is a
  1107. prompt.  In csh, here is how to do it:
  1108.  
  1109.      if ($?prompt) set prompt = ...
  1110.  
  1111. And here's how to do it in bash:
  1112.  
  1113.      if [ "${PS1+set}" = set ]
  1114.      then prompt=...
  1115.      fi
  1116.  
  1117.    There may well be other things that your shell's init file ought to
  1118. do only for an interactive shell.  You can use the same method to
  1119. conditionalize them.
  1120.  
  1121.    The features of Compilation mode are also available in a minor mode
  1122. called Compilation Minor mode.  This lets you parse error messages in
  1123. any buffer, not just a normal compilation output buffer.  Type `M-x
  1124. compilation-minor-mode' to enable the minor mode.  This defines the keys
  1125. RET and `Mouse-2', as in the Compilation major mode.  In an Rlogin
  1126. buffer (*note Remote Host::.), Compilation minor mode automatically
  1127. accesses remote source files by FTP (*note File Names::.).
  1128.  
  1129.    The MS-DOS "operating system" does not support asynchronous
  1130. subprocesses; to work around this lack, `M-x compile' runs the
  1131. compilation command synchronously on MS-DOS.  As a consequence, you must
  1132. wait until the command finishes before you can do anything else in
  1133. Emacs.  *Note MS-DOS::.
  1134.  
  1135. 
  1136. File: emacs,  Node: Debuggers,  Next: Executing Lisp,  Prev: Compilation,  Up: Building
  1137.  
  1138. Running Debuggers Under Emacs
  1139. =============================
  1140.  
  1141.    The GUD (Grand Unified Debugger) library provides an interface to
  1142. various symbolic debuggers from within Emacs.  We recommend the debugger
  1143. GDB, which is free software, but you can also run DBX, SDB or XDB if you
  1144. have them.  GUD can also serve as an interface to the Perl's debugging
  1145. mode.
  1146.  
  1147. * Menu:
  1148.  
  1149. * Starting GUD::    How to start a debugger subprocess.
  1150. * Debugger Operation::    Connection between the debugger and source buffers.
  1151. * Commands of GUD::    Key bindings for common commands.
  1152. * GUD Customization::    Defining your own commands for GUD.
  1153.  
  1154. 
  1155. File: emacs,  Node: Starting GUD,  Next: Debugger Operation,  Up: Debuggers
  1156.  
  1157. Starting GUD
  1158. ------------
  1159.  
  1160.    There are five commands for starting a debugger, each corresponding
  1161. to a particular debugger program.
  1162.  
  1163. `M-x gdb RET FILE RET'
  1164.      Run GDB as a subprocess of Emacs.  This command creates a buffer
  1165.      for input and output to GDB, and switches to it.  If a GDB buffer
  1166.      already exists, it just switches to that buffer.
  1167.  
  1168. `M-x dbx RET FILE RET'
  1169.      Similar, but run DBX instead of GDB.
  1170.  
  1171. `M-x xdb RET FILE RET'
  1172.      Similar, but run XDB instead of GDB.  Use the variable
  1173.      `gud-xdb-directories' to specify directories to search for source
  1174.      files.
  1175.  
  1176. `M-x sdb RET FILE RET'
  1177.      Similar, but run SDB instead of GDB.
  1178.  
  1179.      Some versions of SDB do not mention source file names in their
  1180.      messages.  When you use them, you need to have a valid tags table
  1181.      (*note Tags::.) in order for GUD to find functions in the source
  1182.      code.  If you have not visited a tags table or the tags table
  1183.      doesn't list one of the functions, you get a message saying `The
  1184.      sdb support requires a valid tags table to work'.  If this
  1185.      happens, generate a valid tags table in the working directory and
  1186.      try again.
  1187.  
  1188. `M-x perldb RET FILE RET'
  1189.      Run the Perl interpreter in debug mode to debug FILE, a Perl
  1190.      program.
  1191.  
  1192.    You can only run one debugger process at a time.
  1193.  
  1194.    Each of these commands takes one argument: a command line to invoke
  1195. the debugger.  In the simplest case, specify just the name of the
  1196. executable file you want to debug.  You may also use options that the
  1197. debugger supports.  However, shell wild cards and variables are not
  1198. allowed.  GUD assumes that the first argument not preceded by a `-' is
  1199. the executable file name.
  1200.  
  1201. 
  1202. File: emacs,  Node: Debugger Operation,  Next: Commands of GUD,  Prev: Starting GUD,  Up: Debuggers
  1203.  
  1204. Debugger Operation
  1205. ------------------
  1206.  
  1207.    When you run a debugger with GUD, the debugger uses an Emacs buffer
  1208. for its ordinary input and output.  This is called the GUD buffer.  The
  1209. debugger displays the source files of the program by visiting them in
  1210. Emacs buffers.  An arrow (`=>') in one of these buffers indicates the
  1211. current execution line.  Moving point in this buffer does not move the
  1212. arrow.
  1213.  
  1214.    You can start editing these source files at any time in the buffers
  1215. that were made to display them.  The arrow is not part of the file's
  1216. text; it appears only on the screen.  If you do modify a source file,
  1217. keep in mind that inserting or deleting lines will throw off the arrow's
  1218. positioning; GUD has no way of figuring out which line corresponded
  1219. before your changes to the line number in a debugger message.  Also,
  1220. you'll typically have to recompile and restart the program for your
  1221. changes to be reflected in the debugger's tables.
  1222.  
  1223.    If you wish, you can control your debugger process entirely through
  1224. the debugger buffer, which uses a variant of Shell mode.  All the usual
  1225. commands for your debugger are available, and you can use the Shell mode
  1226. history commands to repeat them.  *Note Shell Mode::.
  1227.  
  1228.